package com.exemplo.helloandroid;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class HelloAndroidActivity extends ListActivity {

	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
	
		String[] names = new String[] { "Arthur Azevedo", "Bruno Britto","Davi Alves", "Gustavo Barbosa", "Thiago de Abreu Lima", "Rafael Batista"};
		
		this.setListAdapter(new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, names));
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		
		Object o = this.getListAdapter().getItem(position);
		String keyword = o.toString();
		Toast.makeText(this, "Voce selecionou: " + keyword, Toast.LENGTH_LONG)
				.show();
	}
}